package com.yanmaohu.yulia.statement;

import com.yanmaohu.yulia.bean.DynamicCursorName;
import com.yanmaohu.yulia.bean.FetchOrientation;
import com.yanmaohu.yulia.bean.OutputUsingClause;

/**
 * @author Bright Lee
 */
public final class DynamicFetchStatement implements SqlDynamicDataStatement, Statement {

    private int beginIndex;
    private int endIndex;
    private FetchOrientation fetchOrientation;
    private boolean from;
    private DynamicCursorName dynamicCursorName;
    private OutputUsingClause outputUsingClause;

    public DynamicFetchStatement(int beginIndex,
                                 FetchOrientation fetchOrientation,
                                 boolean from,
                                 DynamicCursorName dynamicCursorName,
                                 OutputUsingClause outputUsingClause) {
        this.beginIndex = beginIndex;
        this.endIndex = outputUsingClause.getEndIndex();
        this.fetchOrientation = fetchOrientation;
        this.from = from;
        this.dynamicCursorName = dynamicCursorName;
        this.outputUsingClause = outputUsingClause;
    }

    @Override
    public int getBeginIndex() {
        return beginIndex;
    }

    @Override
    public int getEndIndex() {
        return endIndex;
    }

    public FetchOrientation getFetchOrientation() {
        return fetchOrientation;
    }

    public boolean isFrom() {
        return from;
    }

    public DynamicCursorName getDynamicCursorName() {
        return dynamicCursorName;
    }

    public OutputUsingClause getOutputUsingClause() {
        return outputUsingClause;
    }

}
